package pingce.lucene.sentiment;

public class SentimentWord implements Comparable {
	private String text;
	private String polarity;
	private int start;
	private int end;
	private String matchedRegex;
	private boolean isSingleWord = false;
	private String POS = null;
	public boolean isSingleWord() {
		return isSingleWord;
	}
	public void setSingleWord(boolean isSingleWord) {
		this.isSingleWord = isSingleWord;
	}
	public String getPOS() {
		return POS;
	}
	public void setPOS(String pOS) {
		POS = pOS;
	}
	public SentimentWord(String text, String polarity, int start, int end,
			String matchedRegex, boolean isSingleWord, String pOS) {
		super();
		this.text = text;
		this.polarity = polarity;
		this.start = start;
		this.end = end;
		this.matchedRegex = matchedRegex;
		this.isSingleWord = isSingleWord;
		POS = pOS;
	}
	public SentimentWord(String text, String polarity, int start, int end,
			String matchedRegex) {
		super();
		this.text = text;
		this.polarity = polarity;
		this.start = start;
		this.end = end;
		this.matchedRegex = matchedRegex;
	}
	public String getText() {
		return text;
	}
	public void setText(String text) {
		this.text = text;
	}
	public String getPolarity() {
		return polarity;
	}

	@Override
	public String toString() {
		return "SentimentWord [text=" + text + ", polarity=" + polarity
				+ ", start=" + start + ", end=" + end + ", matchedRegex="
				+ matchedRegex + ", isSingleWord=" + isSingleWord + ", POS="
				+ POS + "]";
	}
	public void setPolarity(String polarity) {
		this.polarity = polarity;
	}
	public int getStart() {
		return start;
	}
	public void setStart(int start) {
		this.start = start;
	}
	public int getEnd() {
		return end;
	}
	public void setEnd(int end) {
		this.end = end;
	}
	public String getMatchedRegex() {
		return matchedRegex;
	}
	public void setMatchedRegex(String matchedRegex) {
		this.matchedRegex = matchedRegex;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + end;
		result = prime * result
				+ ((polarity == null) ? 0 : polarity.hashCode());
		result = prime * result + start;
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		SentimentWord other = (SentimentWord) obj;
		if (end != other.end)
			return false;
		if (polarity == null) {
			if (other.polarity != null)
				return false;
		} else if (!polarity.equals(other.polarity))
			return false;
		if (start != other.start)
			return false;
		return true;
	}
	@Override
	public int compareTo(Object arg0) {
		// TODO Auto-generated method stub
		int start2 = ((SentimentWord)arg0).getStart();
		return start - start2;
	}
	
	
}
